package com.allinpay.realm;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author : wushikai
 * <p>
 * date : 2020-09-01
 *
 * 自定义的jdbc realm
 */
public class MyJdbcRealm  extends AuthorizingRealm {


    protected static final String DEFAULT_AUTHENTICATION_QUERY = "select pwd from sys_user where username = ?";

   // protected static final String DEFAULT_SALTED_AUTHENTICATION_QUERY = "select pwd, salt2 from sys_user where username = ?";

    //protected static final String DEFAULT_USER_ROLES_QUERY = "select role_name from user_roles where username = ?";

    protected static final String DEFAULT_PERMISSIONS_QUERY = "select permission from roles_permissions where role_name = ?";

    private static final Logger log = LoggerFactory.getLogger(JdbcRealm.class);


    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {



        return null;
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {



        return null;
    }
}
